A loop-free two-close Gray-code algorithm for listing k-ary Dyck words
نویسندگان
چکیده
P. Chase and F. Ruskey each published a Gray code for length n binary strings with m occurrences of 1, coding m-combinations of n objects, which is two-close—that is, in passing from one binary string to its successor a single 1 exchanges positions with a 0 which is either adjacent to the 1 or separated from it by a single 0. If we impose the restriction that any suffix of a string contains at least k − 1 times as many 0’s as 1’s, we obtain k-suffixes: suffixes of k-ary Dyck words. Combinations are retrieved as special case by setting k = 1 and k-ary Dyck words are retrieved as a special case by imposing the additional condition that the entire string has exactly k − 1 times as many 0’s as 1’s. We generalize Ruskey’s Gray code to the first two-close Gray code for k-suffixes and we provide a loop-free implementation for k 2. For k = 1 we use a simplified version of Chase’s loop-free algorithm for generating his two-close Gray code for combinations. These results are optimal in the sense that there does not always exist a Gray code, either for combinations or Dyck words, in which the 1 and the 0 that exchange positions are adjacent. © 2005 Elsevier B.V. All rights reserved.
منابع مشابه
Ranking and Loopless Generation of k-ary Dyck Words in Cool-lex Order
A binary string B of length n = kt is a k-ary Dyck word if it contains t copies of 1, and the number of 0s in every prefix of B is at most k−1 times the number of 1s. We provide two loopless algorithms for generating k-ary Dyck words in cool-lex order: (1) The first requires two index variables and assumes k is a constant; (2) The second requires t index variables and works for any k. We also e...
متن کاملCool-lex order and k-ary Catalan structures
For any given k, the sequence of k-ary Catalan numbers, Ct,k = 1 kt+1 ( kt t ) , enumerates a number of combinatorial objects, including k-ary Dyck words of length n = kt and k-ary trees with t internal nodes. We show that these objects can be efficiently ordered using the same variation of lexicographic order known as cool-lex order. In particular, we provide loopless algorithms that generate ...
متن کاملGray Codes and Overlap Cycles for Restricted Weight Words
A Gray code is a listing structure for a set of combinatorial objects such that some consistent (usually minimal) change property is maintained throughout adjacent elements in the list. While Gray codes for m-ary strings have been considered in the past, we provide a new, simple Gray code for fixed-weight m-ary strings. In addition, we consider a relatively new type of Gray code known as overla...
متن کاملEfficient Oracles for Generating Binary Bubble Languages
Given a string α = 10γ in a binary language L, the bubble lower bound is the smallest non-negative integer j such that 1s−10t−j10jγ ∈ L. We present an efficient oracle, which is a function that returns the bubble lower bound, for a number of fixed-density languages including: k-ary Dyck words, connected unit interval graphs, linear-extensions ofB-posets, those lexicographically larger than ω, t...
متن کاملShift Gray Codes
Combinatorial objects can be represented by strings, such as 21534 for the permutation (1 2) (3 5 4), or 110100 for the binary tree corresponding to the balanced parentheses (()()). Given a string s = s1s2⋯sn, the right-shift operation ÐÐ→ shift(s, i, j) replaces the substring sisi+1⋯sj by si+1⋯sjsi. In other words, si is right-shifted into position j by applying the permutation (j j−1 ⋯ i) to ...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
- J. Discrete Algorithms
دوره 4 شماره
صفحات -
تاریخ انتشار 2006